package com.cj.allTest;

import com.google.common.collect.Lists;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * @author chan
 * @dateTime 2022/11/29  14:55:21
 */
public class Time2Long {

    public static void main(String[] args) throws ParseException {
        ArrayList<Long> dates = Lists.newArrayList(
                1662566400000L,
                1663430400000L,
                1658332800000L,
                2208825283000L,
                1652630400000L,
                1655049600000L,
                1655827200000L,
                1655827200000L,
                1656604800000L,
                1657036800000L,
                1658246400000L,
                1658851200000L,
                1656432000000L,
                1656604800000L,
                1657209600000L,
                1659888000000L,
                1659888000000L,
                1659974400000L,
                1659974400000L,
                1659974400000L,
                1661184000000L,
                1661270400000L,
                1664035200000L,
                1665158400000L,
                1665158400000L,
                1665417600000L,
                1665417600000L,
                1665417600000L,
                1667318400000L,
                1667318400000L,
                1668528000000L,
                1668441600000L);
        HashMap<Long, String> stringLongHashMap = new HashMap<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        for (Long date : dates) {
            Date date1 = new Date(date);
            String format = sdf.format(date1);
            stringLongHashMap.put(date, format);
        }

        System.out.println(stringLongHashMap);

        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        Date date1 = new Date();
        String format = sdf.format(date1);
        System.out.println(format);
        System.out.println(date1.getTime());
    }
}
